You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
850 lines
18 KiB
850 lines
18 KiB
<script setup lang="ts">
|
|
import { useCharacterSessions } from "~/composables/useCharacterSessions";
|
|
import { useCharacterChat } from "~/composables/useCharacterChat";
|
|
import { useAuthSession } from "~/composables/useAuthSession";
|
|
|
|
definePageMeta({ layout: "character" });
|
|
|
|
const route = useRoute();
|
|
const cardSlug = computed(() => String(route.params.slug));
|
|
const auth = useAuthSession();
|
|
const sessions = useCharacterSessions(cardSlug.value);
|
|
const isMobile = useMediaQuery("(max-width: 767.98px)");
|
|
|
|
interface CardInfo {
|
|
slug?: string;
|
|
name: string;
|
|
avatar?: string | null;
|
|
description?: string | null;
|
|
personality?: string | null;
|
|
scenario?: string | null;
|
|
firstMessage?: string | null;
|
|
exampleDialogue?: string | null;
|
|
tags?: string[];
|
|
}
|
|
|
|
interface ModelOption {
|
|
id: number;
|
|
name: string;
|
|
modelId: string;
|
|
providerName: string;
|
|
}
|
|
|
|
const cardInfo = ref<CardInfo>({ name: "", tags: [] });
|
|
const models = ref<ModelOption[]>([]);
|
|
const selectedModelId = ref<number | null>(null);
|
|
const inputText = ref("");
|
|
const detailShow = ref(false);
|
|
|
|
const chat = useCharacterChat({
|
|
cardSlug: () => cardSlug.value,
|
|
sessionId: () => sessions.currentSessionId.value,
|
|
modelId: () => selectedModelId.value,
|
|
});
|
|
|
|
const showWelcome = computed(() => chat.messages.value.length === 0 && !chat.isLoading.value);
|
|
|
|
async function loadCard() {
|
|
try {
|
|
const res = await $fetch<{ code: number; data: CardInfo }>(
|
|
`/api/characters/${cardSlug.value}/info`,
|
|
);
|
|
cardInfo.value = res.data ?? { name: "", tags: [] };
|
|
} catch {
|
|
cardInfo.value = { name: "", tags: [] };
|
|
}
|
|
}
|
|
|
|
async function loadModels() {
|
|
try {
|
|
const isGuest = !auth.loggedIn.value;
|
|
const endpoint = isGuest
|
|
? `/api/characters/${cardSlug.value}/models`
|
|
: "/api/llm/models";
|
|
const res = await $fetch<{ code: number; data: { list: any[]; defaultModelId?: number | null } }>(endpoint);
|
|
const list = res.data?.list ?? [];
|
|
models.value = list.map((m) => ({
|
|
id: m.id,
|
|
name: m.name,
|
|
modelId: m.modelId,
|
|
providerName: m.providerName ?? "—",
|
|
}));
|
|
const sessionModel = sessions.currentSession.value?.modelId ?? null;
|
|
selectedModelId.value =
|
|
(sessionModel && models.value.some((m) => m.id === sessionModel) ? sessionModel : null) ??
|
|
res.data?.defaultModelId ??
|
|
models.value[0]?.id ??
|
|
null;
|
|
} catch {
|
|
models.value = [];
|
|
}
|
|
}
|
|
|
|
watch(
|
|
() => sessions.currentSessionId.value,
|
|
async (sid) => {
|
|
chat.stopGeneration();
|
|
if (sid) {
|
|
await chat.loadMessages(sid);
|
|
const sessionModel = sessions.currentSession.value?.modelId ?? null;
|
|
if (sessionModel && models.value.some((m) => m.id === sessionModel)) {
|
|
selectedModelId.value = sessionModel;
|
|
} else if (models.value.length > 0 && selectedModelId.value === null) {
|
|
selectedModelId.value = models.value[0]!.id;
|
|
}
|
|
} else {
|
|
chat.clear();
|
|
}
|
|
},
|
|
);
|
|
|
|
async function handleSend(content: string) {
|
|
if (!sessions.currentSessionId.value) {
|
|
await sessions.newSession();
|
|
}
|
|
if (sessions.currentSessionId.value) {
|
|
const sid = sessions.currentSessionId.value;
|
|
sessions.touchSessionOrder(sid);
|
|
await chat.send(content);
|
|
}
|
|
}
|
|
|
|
async function handleNewSession() {
|
|
chat.stopGeneration();
|
|
const sid = sessions.currentSessionId.value;
|
|
if (sid) {
|
|
if (chat.messages.value.length === 0 && !chat.isLoading.value) {
|
|
return;
|
|
}
|
|
}
|
|
await sessions.newSession();
|
|
}
|
|
|
|
async function handleModelChange(id: number) {
|
|
selectedModelId.value = id;
|
|
if (sessions.currentSessionId.value) {
|
|
await sessions.updateModelConfig(sessions.currentSessionId.value, id);
|
|
}
|
|
}
|
|
|
|
function handleSwitchCard(slug: string) {
|
|
navigateTo(`/characters/${slug}`);
|
|
}
|
|
|
|
function handleDetailStart(slug: string) {
|
|
detailShow.value = false;
|
|
navigateTo(`/characters/${slug}`);
|
|
}
|
|
|
|
function onModelSelect(e: Event) {
|
|
const id = Number((e.target as HTMLSelectElement).value);
|
|
if (id) handleModelChange(id);
|
|
}
|
|
|
|
function submit() {
|
|
const text = inputText.value.trim();
|
|
if (!text) return;
|
|
inputText.value = "";
|
|
handleSend(text);
|
|
}
|
|
|
|
onMounted(async () => {
|
|
await Promise.all([loadCard(), loadModels()]);
|
|
await sessions.init();
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="character-chat">
|
|
<!-- 侧边栏 -->
|
|
<aside class="chat-sidebar">
|
|
<header class="sidebar-header">
|
|
<NuxtLink to="/characters" class="back-link">
|
|
<Icon name="lucide:chevron-left" />
|
|
<span>角色卡</span>
|
|
</NuxtLink>
|
|
<button class="new-chat-btn" @click="handleNewSession">
|
|
<Icon name="lucide:plus" />
|
|
<span>新对话</span>
|
|
</button>
|
|
</header>
|
|
|
|
<div class="session-list">
|
|
<div
|
|
v-for="s in sessions.sessions.value"
|
|
:key="s.id"
|
|
class="session-item"
|
|
:class="{ active: s.id === sessions.currentSessionId.value }"
|
|
@click="sessions.selectSession(s.id)"
|
|
>
|
|
<Icon name="lucide:message-square" class="session-icon" />
|
|
<span class="session-title">{{ s.title }}</span>
|
|
<button
|
|
class="session-delete"
|
|
@click.stop="sessions.deleteSession(s.id)"
|
|
title="删除"
|
|
>
|
|
<Icon name="lucide:trash-2" />
|
|
</button>
|
|
</div>
|
|
<div v-if="sessions.sessions.value.length === 0" class="empty-sessions">
|
|
暂无对话
|
|
</div>
|
|
</div>
|
|
|
|
<footer class="sidebar-footer">
|
|
<template v-if="auth.loggedIn.value && auth.user.value">
|
|
<div class="user-row">
|
|
<div class="user-avatar">{{ (auth.user.value.username || "?").charAt(0).toUpperCase() }}</div>
|
|
<span class="user-name">{{ auth.user.value.nickname || auth.user.value.username }}</span>
|
|
</div>
|
|
</template>
|
|
<NuxtLink v-else to="/auth/login" class="login-link">登录以保存对话</NuxtLink>
|
|
</footer>
|
|
</aside>
|
|
|
|
<!-- 主区域 -->
|
|
<main class="chat-main">
|
|
<header class="chat-topbar">
|
|
<div class="agent-identity">
|
|
<div class="agent-avatar">
|
|
<img v-if="cardInfo.avatar" :src="cardInfo.avatar" :alt="cardInfo.name" />
|
|
<span v-else>{{ cardInfo.name.charAt(0) }}</span>
|
|
</div>
|
|
<div class="agent-meta">
|
|
<div class="agent-name">{{ cardInfo.name || "角色" }}</div>
|
|
<div v-if="cardInfo.description" class="agent-desc">{{ cardInfo.description }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="topbar-actions">
|
|
<button class="detail-btn" @click="detailShow = true">
|
|
<Icon name="lucide:info" />
|
|
<span>详情</span>
|
|
</button>
|
|
<div class="model-selector">
|
|
<Icon name="lucide:cpu" class="model-icon" />
|
|
<select
|
|
:value="selectedModelId ?? undefined"
|
|
class="model-select"
|
|
@change="onModelSelect"
|
|
>
|
|
<option :value="undefined" disabled>选择模型</option>
|
|
<option v-for="m in models" :key="m.id" :value="m.id">
|
|
{{ m.name }} ({{ m.modelId }})
|
|
</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<div class="chat-body">
|
|
<!-- 欢迎态 -->
|
|
<div v-if="showWelcome" class="welcome">
|
|
<div class="welcome-avatar">
|
|
<img v-if="cardInfo.avatar" :src="cardInfo.avatar" :alt="cardInfo.name" />
|
|
<span v-else>{{ cardInfo.name.charAt(0) }}</span>
|
|
</div>
|
|
<h1 class="welcome-name">{{ cardInfo.name }}</h1>
|
|
<p v-if="cardInfo.description" class="welcome-desc">{{ cardInfo.description }}</p>
|
|
<div v-if="cardInfo.personality" class="welcome-section">
|
|
<div class="section-label">性格</div>
|
|
<p class="section-text">{{ cardInfo.personality }}</p>
|
|
</div>
|
|
<div v-if="cardInfo.scenario" class="welcome-section">
|
|
<div class="section-label">世界观 / 场景</div>
|
|
<p class="section-text">{{ cardInfo.scenario }}</p>
|
|
</div>
|
|
<div v-if="cardInfo.tags && cardInfo.tags.length" class="welcome-tags">
|
|
<span v-for="t in cardInfo.tags" :key="t" class="tag">{{ t }}</span>
|
|
</div>
|
|
<p v-if="cardInfo.firstMessage" class="welcome-greeting">
|
|
“{{ cardInfo.firstMessage }}”
|
|
</p>
|
|
</div>
|
|
|
|
<!-- 消息列表 -->
|
|
<div v-else class="message-list">
|
|
<div
|
|
v-for="m in chat.messages.value"
|
|
:key="m.id"
|
|
class="message"
|
|
:class="m.role === 'user' ? 'is-user' : 'is-assistant'"
|
|
>
|
|
<div v-if="m.role === 'assistant'" class="msg-avatar">
|
|
<img v-if="cardInfo.avatar" :src="cardInfo.avatar" :alt="cardInfo.name" />
|
|
<span v-else>{{ cardInfo.name.charAt(0) }}</span>
|
|
</div>
|
|
<div class="bubble">{{ m.content }}</div>
|
|
</div>
|
|
<div v-if="chat.isLoading.value" class="typing">
|
|
<span class="dot"></span><span class="dot"></span><span class="dot"></span>
|
|
</div>
|
|
<p v-if="chat.errorMessage.value" class="error-msg">{{ chat.errorMessage.value }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<footer class="chat-input">
|
|
<textarea
|
|
v-model="inputText"
|
|
class="input-textarea"
|
|
rows="1"
|
|
placeholder="和 {{ cardInfo.name || '角色' }} 说点什么…"
|
|
@keydown.enter.exact.prevent="submit"
|
|
/>
|
|
<button
|
|
v-if="chat.isLoading.value"
|
|
class="btn-stop"
|
|
@click="chat.stopAndSave()"
|
|
>
|
|
<Icon name="lucide:square" />
|
|
</button>
|
|
<button
|
|
v-else
|
|
class="btn-send"
|
|
:disabled="!inputText.trim()"
|
|
@click="submit"
|
|
>
|
|
<Icon name="lucide:send" />
|
|
</button>
|
|
</footer>
|
|
</main>
|
|
|
|
<CharacterDetailModal v-model:show="detailShow" :card="cardInfo" @start="handleDetailStart" />
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.character-chat {
|
|
display: flex;
|
|
height: 100vh;
|
|
width: 100vw;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* ===== 侧边栏 ===== */
|
|
.chat-sidebar {
|
|
width: 260px;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
background: var(--color-surface-dark);
|
|
color: var(--color-on-dark);
|
|
}
|
|
|
|
.sidebar-header {
|
|
padding: 16px;
|
|
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
}
|
|
|
|
.back-link {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
color: var(--color-on-dark-soft);
|
|
text-decoration: none;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.back-link:hover {
|
|
color: var(--color-on-dark);
|
|
}
|
|
|
|
.new-chat-btn {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
padding: 10px;
|
|
background: var(--color-primary);
|
|
color: var(--color-on-primary);
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.new-chat-btn:hover {
|
|
background: var(--color-primary-active);
|
|
}
|
|
|
|
.session-list {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
padding: 8px;
|
|
}
|
|
|
|
.session-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 10px 12px;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
color: var(--color-on-dark-soft);
|
|
font-size: 14px;
|
|
}
|
|
|
|
.session-item:hover {
|
|
background: rgba(255, 255, 255, 0.06);
|
|
}
|
|
|
|
.session-item.active {
|
|
background: var(--color-primary);
|
|
color: var(--color-on-primary);
|
|
}
|
|
|
|
.session-icon {
|
|
flex-shrink: 0;
|
|
width: 16px;
|
|
height: 16px;
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.session-title {
|
|
flex: 1;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.session-delete {
|
|
background: transparent;
|
|
border: none;
|
|
color: inherit;
|
|
cursor: pointer;
|
|
opacity: 0;
|
|
transition: opacity 0.15s;
|
|
padding: 2px;
|
|
}
|
|
|
|
.session-item:hover .session-delete {
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.empty-sessions {
|
|
padding: 24px;
|
|
text-align: center;
|
|
color: var(--color-on-dark-soft);
|
|
font-size: 13px;
|
|
}
|
|
|
|
.sidebar-footer {
|
|
padding: 16px;
|
|
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
|
}
|
|
|
|
.user-row {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.user-avatar {
|
|
width: 30px;
|
|
height: 30px;
|
|
border-radius: 8px;
|
|
background: var(--color-primary);
|
|
color: var(--color-on-primary);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.user-name {
|
|
font-size: 13px;
|
|
color: var(--color-on-dark);
|
|
}
|
|
|
|
.login-link {
|
|
font-size: 14px;
|
|
color: var(--color-on-dark-soft);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.login-link:hover {
|
|
color: var(--color-on-dark);
|
|
}
|
|
|
|
/* ===== 主区域 ===== */
|
|
.chat-main {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-width: 0;
|
|
}
|
|
|
|
.chat-topbar {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 16px;
|
|
padding: 12px 20px;
|
|
border-bottom: 1px solid var(--color-hairline);
|
|
background: var(--color-canvas);
|
|
}
|
|
|
|
.agent-identity {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
min-width: 0;
|
|
}
|
|
|
|
.agent-avatar {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 10px;
|
|
overflow: hidden;
|
|
background: var(--color-surface-dark);
|
|
color: var(--color-on-dark);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.agent-avatar img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.agent-meta {
|
|
min-width: 0;
|
|
}
|
|
|
|
.agent-name {
|
|
font-size: 15px;
|
|
font-weight: 500;
|
|
color: var(--color-ink);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.agent-desc {
|
|
font-size: 12px;
|
|
color: var(--color-muted);
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
max-width: 360px;
|
|
}
|
|
|
|
.topbar-actions {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.detail-btn {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
padding: 6px 12px;
|
|
background: var(--color-surface-card);
|
|
border: 1px solid var(--color-hairline);
|
|
border-radius: 8px;
|
|
font-size: 13px;
|
|
color: var(--color-ink);
|
|
cursor: pointer;
|
|
transition: all 0.15s;
|
|
}
|
|
|
|
.detail-btn:hover {
|
|
border-color: var(--color-primary);
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.detail-btn :deep(svg) {
|
|
width: 14px;
|
|
height: 14px;
|
|
}
|
|
|
|
.model-selector {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.model-icon {
|
|
width: 16px;
|
|
height: 16px;
|
|
color: var(--color-muted);
|
|
}
|
|
|
|
.model-select {
|
|
padding: 6px 10px;
|
|
border: 1px solid var(--color-hairline);
|
|
border-radius: 8px;
|
|
font-size: 13px;
|
|
color: var(--color-ink);
|
|
background: var(--color-surface-card);
|
|
outline: none;
|
|
max-width: 220px;
|
|
}
|
|
|
|
.chat-body {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
/* ===== 欢迎态 ===== */
|
|
.welcome {
|
|
max-width: 640px;
|
|
margin: 0 auto;
|
|
padding: 48px 24px;
|
|
text-align: center;
|
|
}
|
|
|
|
.welcome-avatar {
|
|
width: 88px;
|
|
height: 88px;
|
|
border-radius: 22px;
|
|
overflow: hidden;
|
|
background: var(--color-surface-dark);
|
|
color: var(--color-on-dark);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0 auto 20px;
|
|
font-family: var(--font-display);
|
|
font-size: 36px;
|
|
}
|
|
|
|
.welcome-avatar img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.welcome-name {
|
|
font-family: var(--font-display);
|
|
font-size: 30px;
|
|
font-weight: 400;
|
|
color: var(--color-ink);
|
|
margin: 0 0 8px;
|
|
}
|
|
|
|
.welcome-desc {
|
|
font-size: 15px;
|
|
color: var(--color-muted);
|
|
margin: 0 0 24px;
|
|
}
|
|
|
|
.welcome-section {
|
|
text-align: left;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.section-label {
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
color: var(--color-muted);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.section-text {
|
|
font-size: 14px;
|
|
color: var(--color-body);
|
|
line-height: 1.6;
|
|
margin: 0;
|
|
}
|
|
|
|
.welcome-tags {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: center;
|
|
gap: 6px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.tag {
|
|
padding: 2px 10px;
|
|
border-radius: 10px;
|
|
font-size: 12px;
|
|
color: var(--color-primary-active);
|
|
background: rgba(204, 120, 92, 0.1);
|
|
}
|
|
|
|
.welcome-greeting {
|
|
font-style: italic;
|
|
font-size: 14px;
|
|
color: var(--color-muted);
|
|
}
|
|
|
|
/* ===== 消息列表 ===== */
|
|
.message-list {
|
|
max-width: 760px;
|
|
margin: 0 auto;
|
|
padding: 24px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 16px;
|
|
}
|
|
|
|
.message {
|
|
display: flex;
|
|
gap: 10px;
|
|
}
|
|
|
|
.message.is-user {
|
|
flex-direction: row-reverse;
|
|
}
|
|
|
|
.msg-avatar {
|
|
width: 32px;
|
|
height: 32px;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
background: var(--color-surface-dark);
|
|
color: var(--color-on-dark);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-shrink: 0;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.msg-avatar img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.bubble {
|
|
max-width: 70%;
|
|
padding: 10px 14px;
|
|
border-radius: 14px;
|
|
font-size: 14px;
|
|
line-height: 1.6;
|
|
white-space: pre-wrap;
|
|
word-break: break-word;
|
|
}
|
|
|
|
.message.is-user .bubble {
|
|
background: var(--color-primary);
|
|
color: var(--color-on-primary);
|
|
border-bottom-right-radius: 4px;
|
|
}
|
|
|
|
.message.is-assistant .bubble {
|
|
background: var(--color-surface-card);
|
|
color: var(--color-ink);
|
|
border: 1px solid var(--color-hairline);
|
|
border-bottom-left-radius: 4px;
|
|
}
|
|
|
|
.typing {
|
|
display: flex;
|
|
gap: 4px;
|
|
padding: 8px 0;
|
|
}
|
|
|
|
.dot {
|
|
width: 6px;
|
|
height: 6px;
|
|
border-radius: 50%;
|
|
background: var(--color-muted-soft);
|
|
animation: blink 1.2s infinite;
|
|
}
|
|
|
|
.dot:nth-child(2) {
|
|
animation-delay: 0.2s;
|
|
}
|
|
|
|
.dot:nth-child(3) {
|
|
animation-delay: 0.4s;
|
|
}
|
|
|
|
@keyframes blink {
|
|
0%, 100% { opacity: 0.3; }
|
|
50% { opacity: 1; }
|
|
}
|
|
|
|
.error-msg {
|
|
font-size: 13px;
|
|
color: var(--color-error);
|
|
}
|
|
|
|
/* ===== 输入区 ===== */
|
|
.chat-input {
|
|
display: flex;
|
|
align-items: flex-end;
|
|
gap: 10px;
|
|
padding: 16px 20px;
|
|
border-top: 1px solid var(--color-hairline);
|
|
background: var(--color-canvas);
|
|
}
|
|
|
|
.input-textarea {
|
|
flex: 1;
|
|
resize: none;
|
|
padding: 10px 14px;
|
|
border: 1px solid var(--color-hairline);
|
|
border-radius: 10px;
|
|
font-size: 14px;
|
|
line-height: 1.5;
|
|
color: var(--color-ink);
|
|
background: var(--color-surface-card);
|
|
outline: none;
|
|
font-family: inherit;
|
|
}
|
|
|
|
.input-textarea:focus {
|
|
border-color: var(--color-primary);
|
|
}
|
|
|
|
.btn-send,
|
|
.btn-stop {
|
|
width: 40px;
|
|
height: 40px;
|
|
border: none;
|
|
border-radius: 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
cursor: pointer;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.btn-send {
|
|
background: var(--color-primary);
|
|
color: var(--color-on-primary);
|
|
}
|
|
|
|
.btn-send:hover:not(:disabled) {
|
|
background: var(--color-primary-active);
|
|
}
|
|
|
|
.btn-send:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.btn-stop {
|
|
background: var(--color-surface-dark);
|
|
color: var(--color-on-dark);
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.chat-sidebar {
|
|
position: absolute;
|
|
z-index: 20;
|
|
height: 100%;
|
|
transform: translateX(-100%);
|
|
transition: transform 0.2s ease;
|
|
}
|
|
}
|
|
</style>
|
|
|